<template>
  <div>
    <el-form-item label="自动播放" class="tr">
      <el-switch v-model="value.__config.autoplay"> </el-switch>
    </el-form-item>

    <el-form-item label="循环播放" class="tr">
      <el-switch v-model="value.__config.loop"> </el-switch>
    </el-form-item>

    <el-form-item label="静音" class="tr">
      <el-switch v-model="value.__config.muted"> </el-switch>
    </el-form-item>

    <el-form-item label="控制条" class="tr">
      <el-switch v-model="value.__config.controls"> </el-switch>
    </el-form-item>

    <el-form-item label="封面">
      <el-radio-group v-model="value.__config.posterLocation">
        <el-radio
          v-for="item in posterLocationEnum"
          :key="item.code"
          :label="item.code"
          >{{ item.name }}</el-radio
        >
      </el-radio-group>

      <el-input
        size="small"
        v-show="value.__config.posterLocation === 'remote'"
        type="textarea"
        rows="8"
        placeholder="请输入封面链接"
        v-model="value.__config.posterSrc"
      ></el-input>

      <MediaUpload
        accept="image/png, image/jpeg"
        :size="5"
        tip="只能上传png/jpg文件，且不超过5MB"
        v-show="value.__config.posterLocation === 'local'"
        :file.sync="value.__config.posterSrc"
      />
    </el-form-item>

    <!-- <BaseSwitch label="渲染为表单项" :value.sync="value.__config.isFormItem" /> -->
  </div>
</template>

<script>
import basicmixins from "../basicmixins";
import MediaUpload from "./MediaUpload";

export default {
  name: "VideoMediaAdvancedProps",
  components: {
    MediaUpload,
  },

  mixins: [basicmixins],

  data() {
    return {
      posterLocationEnum: [
        { code: "remote", name: "封面链接" },
        { code: "local", name: "封面上传" },
      ],
    };
  },

  computed: {},

  watch: {
    "value.__config.posterLocation"() {
      this.value.__config.posterSrc = "";
    },
  },

  methods: {},
};
</script>

<style lang="less"></style>
